@include('admin.layout.css')
@include('admin.layout.js')




<div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list" style="padding: 20px 30px 0 0;">

    <div class="layui-form-item">
        <label class="layui-form-label">图片</label>
        <div class="layui-input-block">
            <button type="button" class="layui-btn" id="test1">上传图片</button>
            <input type="hidden" name="img_url" id="img_url" value="{{$info['img_url']}}">
            <div class="layui-upload-list" >
                <img class="layui-upload-img" src="{{$info['img_url']}}"  id="img_url_show" width="92px" height="92px">
                <p id="demoText"></p>
            </div>
        </div>
    </div>



    <div class="layui-form-item">
        <label class="layui-form-label">图片说明</label>
        <div class="layui-input-block">
            <input type="text"  name="tip" value="{{$info['tip']}}"  placeholder="请输入图片说明" autocomplete="off" class="layui-input" >

         </div>
    </div>




    <div class="layui-form-item">
        <label class="layui-form-label">点击类型</label>
        <div class="layui-input-block">
            <input type="radio" name="click_type" value="0" title="仅展示" @if($info['click_type'] == 0) checked @endif>
            <input type="radio" name="click_type" value="1" title="VIP详情" @if($info['click_type'] == 1) checked @endif>
            <input type="radio" name="click_type" value="2" title="普通项目" @if($info['click_type'] == 2) checked @endif>
         </div>
    </div>



    <div class="layui-form-item">
        <label class="layui-form-label">点击数据</label>
        <div class="layui-input-block">
            <input type="text"  name="click_data" value="{{$info['click_data']}}" placeholder="点击数据" autocomplete="off" class="layui-input" >
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">排序</label>
        <div class="layui-input-block">
            <input type="text" value="{{$info['images_sort']}}"  name="images_sort"  placeholder="排序" autocomplete="off" class="layui-input" >
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">显示状态</label>
        <div class="layui-input-block">
            <input type="radio" name="show" value="0" title="隐藏" @if($info['show'] == 0) checked @endif>
            <input type="radio" name="show" value="1" title="显示" @if($info['show'] == 1) checked @endif>
        </div>
    </div>

    <input type="hidden" name="id" value="{{$info['id']}}">


    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit lay-filter="submit" id="submit" value="确认">
        <input type="button" lay-submit lay-filter="layuiadmin-app-form-edit" id="layuiadmin-app-form-edit" value="取消">
    </div>

</div>


<script>

    UI.upload('#test1',function (res) {
        if (res.code !== 200) {
            Utils.errorToast(res.msg);
        }else{
            Utils.successToast('上传成功');
            $('#img_url_show').attr('src',res['data']['src']);
            $('#img_url').val(res['data']['src']);
        }
    });

    layui.use(['laydate','form'], function() {
        let form = layui.form;
        form.on('submit(submit)', function(data){

            Api.add("{{route('admin.images.edit')}}",data.field,function(res){
                if (res.code !== 200){
                    Utils.errorToast(res.msg);
                    return;
                }
            });
        });


    });
</script>
